# RUN: ld64.lld.darwinold -arch armv7 -r -print_atoms %s -o %t  | FileCheck %s
# RUN: ld64.lld.darwinold -arch armv7 -r -print_atoms %t -o %t2  | FileCheck %s
# RUN: ld64.lld.darwinold -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/armv7/libSystem.yaml \
# RUN:   && llvm-objdump --macho --private-headers %t3.dylib | FileCheck --check-prefix=CHECK2 %s
#
# Test parsing LC_DATA_IN_CODE
#
#

--- !mach-o
arch:            armv7
file-type:       MH_OBJECT
flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
sections:
  - segment:         __TEXT
    section:         __text
    type:            S_REGULAR
    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
    alignment:       2
    address:         0x0000000000000000
    content:         [ 0x00, 0xBF, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                       0x03, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0xBF,
                       0x00, 0xF0, 0x20, 0xE3, 0x0A, 0x00, 0x00, 0x00,
                       0x0B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
                       0x0D, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3 ]
local-symbols:
  - name:            _foo_thumb
    type:            N_SECT
    sect:            1
    desc:            [ N_ARM_THUMB_DEF ]
    value:           0x0000000000000000
  - name:            _foo_arm
    type:            N_SECT
    sect:            1
    value:           0x0000000000000018
dataInCode:
  - offset:          0x00000004
    length:          0x0004
    kind:            DICE_KIND_DATA
  - offset:          0x00000008
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE32
  - offset:          0x0000000C
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE16
  - offset:          0x00000010
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE8
  - offset:          0x0000001C
    length:          0x0004
    kind:            DICE_KIND_DATA
  - offset:          0x00000020
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE32
  - offset:          0x00000024
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE16
  - offset:          0x00000028
    length:          0x0004
    kind:            DICE_KIND_JUMP_TABLE8
...



# CHECK: defined-atoms:
# CHECK:   - name:            _foo_thumb
# CHECK:     references:
# CHECK:       - kind:            modeThumbCode
# CHECK:         offset:          0
# CHECK:       - kind:            modeData
# CHECK:         offset:          4
# CHECK:         addend:          1
# CHECK:       - kind:            modeData
# CHECK:         offset:          8
# CHECK:         addend:          4
# CHECK:       - kind:            modeData
# CHECK:         offset:          12
# CHECK:         addend:          3
# CHECK:       - kind:            modeData
# CHECK:         offset:          16
# CHECK:         addend:          2
# CHECK:       - kind:            modeThumbCode
# CHECK:         offset:          20
# CHECK:   - name:            _foo_arm
# CHECK:     references:
# CHECK:       - kind:            modeData
# CHECK:         offset:          4
# CHECK:         addend:          1
# CHECK:       - kind:            modeData
# CHECK:         offset:          8
# CHECK:         addend:          4
# CHECK:       - kind:            modeData
# CHECK:         offset:          12
# CHECK:         addend:          3
# CHECK:       - kind:            modeData
# CHECK:         offset:          16
# CHECK:         addend:          2
# CHECK:       - kind:            modeArmCode
# CHECK:         offset:          20


# CHECK2:      cmd LC_DATA_IN_CODE
# CHECK2:  cmdsize 16
# CHECK2: datasize 64


#	.code	16
#  .thumb_func	_foo_thumb
#_foo_thumb:
# nop
# nop
#
#	.data_region
#  .long 0
#	.end_data_region
#
#	.data_region jt32
#  .long 1
#	.end_data_region
#
#	.data_region jt16
#  .long 2
#	.end_data_region
#
#	.data_region jt8
#  .long 3
#	.end_data_region
#
#  nop
#  nop
#
#
#
#	.code	32
#  .align 2
#_foo_arm:
#  nop
#
#	.data_region
#  .long 10
#	.end_data_region
#
#	.data_region jt32
#  .long 11
#	.end_data_region
#
#	.data_region jt16
#  .long 12
#	.end_data_region
#
#	.data_region jt8
#  .long 13
#	.end_data_region
#
#  nop
#
